#!/usr/bin/python
# _*_ coding: utf8 _*_
#Created: 2010. 6. 19.

##GLOBALS
g_dbFileName = './db/tide.db'

##IMPORTS
import sqlite3

class CTideDataGetDB():
    m_dsTideDataSet = []
    
    def __init__ (self, a_stArea, a_inYear, a_inMonth, a_inDay):
        #데이터를 가져오는 과정. 결과값을 셋트로 던져줌
        pass
        global g_dbFileName
        con = sqlite3.connect(g_dbFileName)
        cur = con.cursor()
        cur.execute("SELECT Hour, Min, Height from " \
                               + a_stArea \
                               + " WHERE YEAR = " \
                               + str(a_inYear) \
                               + " and Month = " \
                               + str(a_inMonth) \
                               + " and Day = " \
                               + str(a_inDay) + ";")
        self.m_dsTideDataSet = cur.fetchall()


    def GetDataFormed(self):
        for stTideData in self.m_dsTideDataSet:
            inHour, inMin, inHeight = stTideData
            formedData = str(inHour) + u"시\t" + str(inMin) + u"분 :\t수위 " + str(inHeight) + u"cm"
            print formedData
        return True
        
    def GetDataJSON(self):
        pass
        #데이터를 Json 형식으로 출력하는 메소드

def main():
    pass
    MainRun = CTideDataGetDB('INCHEON', 2010, 6, 10)
    MainRun.GetDataFormed()
    #MainRun.GetDataJSON()


if __name__ == "__main__":
    main()
